package com.wigem.fa.controller;

import com.wigem.framework.common.pojo.PageResult;
import com.wigem.framework.common.util.web.response.Result;
import com.wigem.framework.common.util.web.response.ResultController;

import java.util.List;

import com.wigem.fa.entity.FaEntInfoEntity;
import com.wigem.fa.service.FaEntInfoService;
import com.wigem.fa.vo.FaEntInfoVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.swing.text.html.parser.Entity;

/**
 * 申报企业基本信息Controller
 *
 * @author DH
 * @date 2024-10-20
 */
@RestController
@RequestMapping("/fa/entInfo")
public class FaEntInfoController extends ResultController {


    @Resource
    private FaEntInfoService faEntInfoService;

    /**
     * 查询申报企业基本信息列表
     */
    @ResponseBody
    @GetMapping("/query")
    public Result getList(FaEntInfoVo faEntInfoVo) {
        return success(faEntInfoService.getList(faEntInfoVo));
    }

    /**
     * 查询申报企业基本信息列表
     */
    @ResponseBody
    @GetMapping("/query/page")
    public Result getPageList(FaEntInfoVo faEntInfoVo) {
        PageResult<FaEntInfoEntity> pageInfo = faEntInfoService.getPageList(faEntInfoVo);
        return success(pageInfo);
    }

    /**
     * 查询申报企业基本信息实体
     */
    @ResponseBody
    @GetMapping("/query/{id}")
    public Result getEntity(@PathVariable("id") String id) {
        return success(faEntInfoService.getEntity(id));
    }

    @ResponseBody
    @GetMapping("/query/enterpriseInfo")
    public Result getEntityByCreateUser() {
        return success(faEntInfoService.getEntityByCreateUser());
    }


    /**
     * 申报企业基本信息新增
     */
    @ResponseBody
    @PostMapping
    public Result add(@RequestBody FaEntInfoVo faEntInfoVo) {
        faEntInfoService.add(faEntInfoVo);
        return success("保存成功");
    }

    /**
     * 申报企业基本信息修改
     */
    @ResponseBody
    @PutMapping
    public Result update(@RequestBody FaEntInfoVo faEntInfoVo) {
        faEntInfoService.update(faEntInfoVo);
        return success("修改成功");
    }


    /**
     * 新增保存
     */
    @ResponseBody
    @PostMapping("/save")
    public Result save(@RequestBody FaEntInfoVo faEntInfoVo) {
        faEntInfoService.save(faEntInfoVo);
        return success("保存成功！");
    }


    /**
     * 删除
     */
    @ResponseBody
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") String id) {
        faEntInfoService.delete(id);
        return success("删除成功！");
    }

    /**
     * 移除/逻辑删除
     */
    @ResponseBody
    @DeleteMapping("/remove/{id}")
    public Result remove(@PathVariable("id") String id) {
        faEntInfoService.remove(id);
        return success("删除成功！");
    }
}
